
#include <st-common.h>

/* isr()
 * {
 *      do something;
 *      isr_prio_chain();
 * }
 **/

st_boolean st_task_need_reschedule = ST_TRUE;

#define ST_TASK_DO      do 
#define ST_TASK_WHILE   while(!st_task_need_reschedule)

enum _st_task_state
{
    ST_TASK_IDLE=0,
    ST_TASK_READY,
    ST_TASK_RUNNING
};
typedef enum _st_task_state st_task_state;

struct _st_task
{
    st_uint8        id;
    st_uint8        prio;                       /* priority */
    st_task_state   state;
    // trigger condition;

    void        (*proc)(void* arg);
};
typedef struct _st_task st_task;
    

st_task     tasks[256];

{
    st_task_Create(task1);
    st_task_Create(task2);
    st_task_Create(task3);
}


void st_task_Schedule(void)
{
    st_task* task;
    task = find_highest_prio_task();
    task->proc(NULL);
    task->state = ST_TASK_IDLE;
}






